//
//  WQCBaseTableViewController.swift
//  3-微博
//
//  Created by DDDD on 16/2/26.
//  Copyright © 2016年 gongsimingzi. All rights reserved.
//

import UIKit

class WQCBaseTableViewController: UITableViewController,WQCVisitorDelegate{
    
    var visitor :WQCVisitor?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
//        UINavigationController()
        
        if WQCUserViewModel.userViewModel.isLogin {
            
            visitor = WQCVisitor()
            
            view = visitor
            
            visitor?.delegate = self
            
            setNav()

            
        }else{
            
            super.loadView()
           

        }
    }
    
    func setNav(){
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登陆", style: UIBarButtonItemStyle.Plain, target: self, action: "didLogin")
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "didRequired")
    }

    
    func didLogin() {
//        print("控制器登陆")
    }
    func didRequired() {
//        print("控制器注册")
         let login = WQCLoginViewController()
         let nav = UINavigationController(rootViewController: login)
        
         presentViewController(nav, animated: true) { () -> Void in
                
        }
    }
    
    
   }
